{% extends "base.html" %}

{% block title4 %}
    active
{% endblock %}

{% block page-body %}
    <h1 class="page-header">信息查询</h1>

    <!--面板 开始-->
    <div class="panel panel-primary">
        <div class="panel-heading">基线加固</div>
        <div class="panel-body">
            <div class="row">
                <div class="col-md-12 main">
                    <form action="/search_baseline/" method="post">
                        {% csrf_token %}
                        <div class="col-md-4" style="padding-bottom: 4px;padding-left:0px">
                            <div class="input-group">
                                <input name="ip" id="serach_ip" type="text" class="form-control" placeholder="请输入IP">
                                <span class="input-group-btn"><button style="padding:6px 12px 7px;"
                                                                      class="btn btn-default"
                                                                      type="submit">搜索</button></span>
                            </div><!-- /input-group -->
                        </div>

                    </form>
                    <div class="col-md-1  pull-right" style="padding-bottom: 3px;padding-right: 0px">
                        <a href="/add_myworkbaseline/" class="btn btn-success btn-sm pull-right">添加</a>
                    </div>
                    <table class="table table-bordered table-hover table-condensed text-justify">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>IP</th>
                            <th>加固日期</th>
                            <th>系统版本</th>
                            {% if request.session.username %}
                                <th>操作</th>
                            {% endif %}
                        </tr>
                        </thead>
                        <tbody>
                        {% for i in baseline %}
                            <tr>
                                <td>{{ forloop.counter|add:start }}</td>
                                <td>{{ i.ip }}</td>
                                <td>{{ i.date.isoformat }}</td>
                                <td>{{ i.os.os }}</td>
                                {% if request.session.username %}
                                    <td>
                                        <a href="/edit_baseline/?id={{ i.id }}" class="btn btn-warning btn-sm"
                                           type="button">修改</a>

                                        <a href="/del_myworkbaseline/?id={{ i.id }}" class="btn btn-danger">删除</a>
                                    </td>
                                {% endif %}
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    <nav class="pull-right" aria-label="Page navigation">
                        <ul class="pagination">
                            {{ page_info.pager|safe }}
                        </ul>
                    </nav>
                </div>
            </div>
            <!--面板body 结束-->
        </div>
{% endblock %}